package botcc.androidBot;

import java.net.MalformedURLException;

import org.aitools.programd.interfaces.shell.Shell;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;

public class BoTccActivity extends Activity {
    /** Called when the activity is first created. */
	
	private Shell shell;
	 
	/** 
	 * Initializes the needed program-D classes
	 * rodrigo.silva
	 * @throws MalformedURLException 
	 */
	public void initializeProgramD() {
		String[] args = {getFilesDir().getAbsolutePath()};
		AndroidProgramDAdapter.main(args);
	}
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
    
    public void vaiParaChat(View v) throws MalformedURLException
    {                        
    	setContentView(R.layout.chat);
    	initializeProgramD();
    }
    
    public void voltaParaMenu(View v)
    {                        
    	setContentView(R.layout.main);
    }
    
    public void fechaApp(View v) {
    	finish();
    }
    
    public void enviaMsgBot(View v)
    {
    	EditText edtMsgToBot = (EditText) findViewById(R.id.edtMsgToBot);
    	String msg = edtMsgToBot.getEditableText().toString();
    	shell.run();
    }
}